﻿#include "u_mainpage.h"
#include "Window/Data/u_channel_panel.h"

MainPage::MainPage(QWidget *parent) : MyWidget(parent)
{

    this->InitWidget();
    this->SetupConnections();
    this->Initialize();

    timer = new QTimer;
    connect(timer, SIGNAL(timeout()), this, SLOT(OnTimer()));
}

void MainPage::InitWidget(){
    QGridLayout *chanLayout = new QGridLayout();//栅栏布局
    chanLayout->setMargin(15);
    chanLayout->setSpacing(20);
    for(int i=0; i<globalData->equList.size(); i++){
        Equipment *equ = globalData->equList[i];
        ChannelPanel *panel = new ChannelPanel(equ->serialName);
        chanLayout->addWidget(panel, i/2,i%2+1,1,1);//控件名 行 列 占用行数 占用列数 对齐方式（默认）
    }

    this->setLayout(chanLayout);
}

void MainPage::SetupConnections(){

}

void MainPage::Initialize(){

}

void MainPage::OnTimer(){

}

